<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="me.yobol.greentable.commons.path.*" %>
<%@ page import="me.yobol.greentable.commons.LoginStatus"%>

<%
	int loginStatus = LoginStatus.ANONYMOUS;
	Object obj = session.getAttribute("LoginStatus");
	if(obj != null){
		loginStatus = (Integer)obj;
	}
%>

<link rel="stylesheet" type="text/css" href="<%=CPath.cCommons(request) %>">
<link rel="stylesheet" type="text/css" href="<%=CPath.cHeader(request)%>"/>
<div id="header" class="fixed">
	<div class="w_1280 h_58 relative">
		<!-- logo begin -->
		<%-- 图片宽度为110px * 40px --%>
		<div id="logo">
			<a href="<%=PPath.pIndex(request)%>">
				<img alt="Yobol" src="<%=RPath.getImgUrl(request, "yobol_logo.png")%>" />
			</a>
		</div>
		<!-- logo end -->
		
		<!-- nav begin -->
		<div id="nav">
			<ul class="h_58">
				<li><a href="<%=PPath.pIndex(request)%>">首页</a></li>
				<li><a href="<%=SPath.sGetDishesList(request, "?flag=0")%>">食谱</a></li>
				<li><a href="<%=SPath.sGetIngredientList(request,"?flag=0")%>">食材</a></li>
			</ul>
		</div>
		<!-- nav end -->
		
		<!-- icon box begin -->
		<div id="icon_box">
			<!-- 搜索框 -->
			<span class="icon search" onclick="showSearchBox();"> </span>

			<!-- pc为personal center缩写,即个人中心 -->
			<span class="icon pc relative" onmouseover="showPcSubmenu();" onmouseout="hidePcSubmenu();"> 
				<!-- pc_submenu_top是上面个人中心标签上面的那个三角 -->
				<i id="pc_submenu_top" class="submenu_top absolute"></i>
				<dl id="pc_submenu" class="submenu absolute">
					<%
						if (loginStatus == LoginStatus.ANONYMOUS) {
					%>
					<dd>
						<a href="<%=PPath.pRegister(request)%>" class="pc_first">注册</a>
						<span class="sep">|</span>
						<a href="<%=PPath.pLogin(request)%>" class="pc_first">登录</a>
					</dd>
					<%
						} else {
					%>
					<dd>
						<!-- 在这里获取用户名不能使用request.getParameter("uName")，不然当点击超链接重定向到首页时，就获取不到正确的用户名了 -->
						<p id="welcome_slogan">欢迎,<%=request.getSession().getAttribute("uName") %></p>
					</dd>
					<dd>
						<i class="grzx relative"></i>
						<a href="<%=PPath.pIndex(request)%>" class="pc_no_frist">个人中心</a>
					</dd>
						<%
							if(loginStatus == LoginStatus.CUSTOMER){
						%>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=SPath.sGetCartCommodityList(request) %>" class="pc_no_frist">购物车</a>
						</dd>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=SPath.sGetProcessingOrder(request) %>" class="pc_no_frist">我的订单</a>
						</dd>
						<%
							}
						%>
						<%
							if(loginStatus == LoginStatus.WORKER){
						%>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=PPath.pCreateDishes(request)%>" class="pc_no_frist">创建食谱</a>
						</dd>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=SPath.sGetDishesList(request, "?flag=1")%>" class="pc_no_frist">我的食谱</a>
						</dd>
						<%
							}
						%>
						<%
							if(loginStatus == LoginStatus.TRADER){
						%>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=SPath.sGetProcessingOrder(request) %>" class="pc_no_frist">我的订单</a>
						</dd>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=PPath.pCreateIngredient(request)%>" class="pc_no_frist">添加食材</a>
						</dd>
						<dd>
							<i class="heart relative"></i>
							<a href="<%=SPath.sGetIngredientList(request,"?flag=1")%>" class="pc_no_frist">我的食材</a>
						</dd>
						<%
							}
						%>
					<dd>
						<i class="exit relative"></i>
						<a href="<%=SPath.sLoginOut(request)%>" class="pc_no_frist">退出登录</a>
					</dd>
					<%
						}
					%>
				</dl>
			</span>
		</div>
		<!-- icon-box end -->
		<!-- search box begin -->
		<form action="<%=SPath.sSearch(request)%>" method="post" id="search_box" class="search_box relative">
			<div id="search_box_left" class="search_box_left show_search_box_left">
				<input type="submit" id="search_icon" class="search_icon" value="" />
				<input type="text" id="search_bar" class="search_bar" placeholder="搜索" name="searchkey"/>
			</div> 
			<i id="close_icon" class="close_icon anti_rotate_close_icon absolute" onclick="clickCloseIcon();"></i>
		</form>
		<!-- search box end -->
	</div>
	</div>
	<script type="text/javascript" src="<%=JPath.jJquery(request)%>"></script>
	<script type="text/javascript" src="<%=JPath.jHeader(request) %>"></script>
</div>
